home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / butil.arc / BLOAD.BAS < prev    next >
Encoding:
BASIC Source File  |  1985-10-11  |  2.9 KB  |  69 lines

  1.  
  2.  
  3. 100 ' This programs displays pictures created with PC Paint.  These files 
  4. 110 ' are in the standard "BLOAD" format and as such are fully compatible with
  5. 120 ' systems such as the Polaroid Palette.  There is information regarding
  6. 130 ' color stored in the extra space between the odd and even scan lines.
  7. 140 ' This program demonstrates how to use that information.
  8. 150 '
  9. 160 DEFINT A-Z        'All variables integer
  10. 170 MODESAVE = &H465    'BIOS Mode location
  11. 180 MODEREG = &H3D8    'Mode Register on video controller
  12. 190 BWENABLE = &H4    'Bit to set on Mode byte to control Burst
  13. 200 COLREG = &H3D9    'Color Register on video controller
  14. 210 HIGHENABLE = &H10    'Bit to set on Color byte to control intensity
  15. 220 PALETTEBIT = &H20    'Palette bit in Color byte
  16. 230 SCREEN 0,1,0    'Text mode
  17. 240 WIDTH 80        'Set to 80 columns
  18. 250 KEY OFF
  19. 260 CLS            'Clear the screen
  20. 270 '
  21. 280 ' The program expects the first name of the file only.  For example,
  22. 290 ' "SAILING.PIC" should be entered as "SAILING".
  23. 300 '
  24. 310 INPUT "Enter Picture File Name: ",N$
  25. 320 SCREEN 1,0,0    'Medium Resolution mode
  26. 330 DEF SEG = &HB800    'Video memory segment
  27. 340 BLOAD N$+".PIC",0    'Load the picture file
  28. 350 '
  29. 360 ' Background and palette information are in two of the bytes that are
  30. 370 ' not used by the picture.
  31. 380 '
  32. 390 PALETTE=PEEK(8012)        ' Get palette byte
  33. 400 BACKGROUND=PEEK(8013)    ' Get background byte
  34. 410 '
  35. 420 ' If palette is 3,4, or 5, then high intensity palette is enabled.
  36. 430 ' (See comments below.)
  37. 440 '
  38. 450 IF PALETTE>=3 THEN BACKGROUND = BACKGROUND OR HIGHENABLE
  39. 460 '
  40. 470 ' Palettes 0 and 3 are video palette 1, burst disabled
  41. 480 ' Palettes 1 and 4 are video palette 0, burst disabled
  42. 490 ' Palettes 2 and 5 are video palette 1 (doesn't matter), burst enabled
  43. 500 '
  44. 510 IF PALETTE=0 OR PALETTE=3 THEN PALETTE=1 : BURST = 0 : GOTO 650
  45. 520 IF PALETTE=1 OR PALETTE=4 THEN PALETTE=0 : BURST = 0 : GOTO 650
  46. 530 IF PALETTE=2 OR PALETTE=5 THEN PALETTE=1 : BURST = 1
  47. 540 '
  48. 550 ' The color register accepts one byte with the following format:
  49. 560 ' Bits 0-3: Background color
  50. 570 ' Bit    4: Intensified foreground colors
  51. 580 ' Bit    5: Active palette
  52. 590 ' Bits 6-7: Not used
  53. 600 '
  54. 610 ' The background byte is already in this format, so the palette
  55. 620 ' information is used to set bits 4 and 5.  Line number 450 set
  56. 630 ' the high intensity bit, and line 650 sets the palette bit.
  57. 640 '
  58. 650 IF PALETTE=1 THEN BACKGROUND = BACKGROUND OR PALETTEBIT
  59. 660 OUT COLREG,BACKGROUND    ' Send color byte to the color register
  60. 670 DEF SEG = 0
  61. 680 MODE = PEEK(MODESAVE)                ' Get current mode
  62. 690 IF BURST = 0 THEN MODE = MODE AND (NOT BWENABLE)    ' Disable burst
  63. 700 IF BURST = 1 THEN MODE = MODE OR BWENABLE        ' or enable burst
  64. 710 POKE MODESAVE,MODE                    ' Save new mode
  65. 720 OUT MODEREG,MODE                    ' Send the mode byte
  66. 730 END
  67.  
  68. or enable burst
  69. 710 POKE MODESAVE,MODE                    ' Save new mode
  70. 720 OUT MODEREG,MODE                    ' Send th